#include "Logger.h"
#include "MyRunTest.h"
#include "Test0.cuh"
#include "Test1.cuh"
#include "gpu100.cuh"

int main()
{
    //xxxxxxxxxxxxxxxxxxxxxxxxx 初始化日志系统
    initializeLogger();
    // 记录程序启动
    logInfo("Program start");

    // 运行测试
    try
    {
        // 初始化CUDA
        CUDA_CALLC(cudaSetDevice(0));
        spdlog::info("CUDA initialization successful, Starting all CUDA tests...");
        ///========================= 运行所有测试
        ///
        runTest(te0_0::tt);
        runTest(te0_1::tt);

        ///
        runTest(te1_0::tt);
        runTest(te1_1::tt);
        runTest(te1_2::tt);
        //============================= gpu100
        yb_1::tt();

        //=============================
        spdlog::info("All tests completed successfully");
        return 0;
    }
    catch (const std::exception& e)
    {
        spdlog::error("Program exception: {0}", e.what());
        return 1;
    }

    // cudaDeviceReset must be called before exiting in order for profiling and
    // tracing tools such as Nsight and Visual Profiler to show complete traces.
    CUDA_CALLC(cudaDeviceReset());

    //xxxxxxxxxxxxxxxxxxxxxxxxx 记录程序结束并清理日志系统
    // logInfo("Program end");
    shutdownLogger();

    return 0;
}